package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.ProductInfoVO;
import com.digitalchina.lxnsy.toolkit.FrescoUtil;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：白彦东
 * 创建时间：2016/12/28 18:10
 * 修改备注：
 * ================================================
 */

public class ProductListHolder extends BaseViewHolder<ProductInfoVO> {

    //    private View contentView;
    private SimpleDraweeView ivImage;
    private TextView tvTitle;
    private TextView tvSummary;
    private TextView tvPrice;
    private TextView tvType;


    public ProductListHolder(ViewGroup parent) {
        super(parent, R.layout.item_product);
        ivImage = $(R.id.item_iv_images);
        tvTitle = $(R.id.item_tv_title);
        tvSummary = $(R.id.item_tv_summary);
        tvPrice = $(R.id.item_tv_price);
        tvType = $(R.id.item_tv_type);
    }

    @Override
    public void setData(ProductInfoVO data) {
        super.setData(data);

        FrescoUtil.showImageSmall(data.getProductImageList() != null ? data.getProductImageList().get(0).getImage() : "", ivImage);
        tvTitle.setText(data.getName());
        tvSummary.setText(data.getSummary());
        tvPrice.setText(getContext().getResources().getString(R.string.RMB) + data.getPrice());
        tvType.setText(data.getType().getName());

    }
}
